home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Demo's / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Image and Contour Plots / AppendImageToContour next >
Text File  |  1996-02-27  |  1KB  |  39 lines

  1. #include <Keyword-Value>
  2.  
  3. | version 1.01
  4. Macro AppendImageToContour(plot,n)
  5.     String plot
  6.     Variable n=20
  7.     Prompt plot,"contour plot",popup,ContourNameList("",";")
  8.     Prompt n,"number of rows (and columns) for image"
  9.  
  10.     Silent 1;PauseUpdate
  11.     String info=ContourInfo("",plot,0)
  12.     String haxis= StrByKey("XAXIS",info)
  13.     String vaxis= StrByKey("YAXIS",info)
  14.     String xwave= StrByKey("XWAVE",info)
  15.     String ywave= StrByKey("YWAVE",info)
  16.     String zwave= StrByKey("ZWAVE",info)
  17.     String flags= StrByKey("AXISFLAGS",info)
  18.     String type=StrByKey("DATAFORMAT",info)
  19.     Variable doContourZ= CmpStr(type,"XYZ") == 0
  20.     | Make matrix that spans displayed X and Y
  21.     String image=zwave
  22.     if( doContourZ )
  23.         image=CleanupName(image+"Image",1)    // not necessarily a unique name
  24.         Make/O/N=(n,n) $image                // overwrite
  25.         GetAxis/Q $haxis
  26.         SetScale/I x, V_min, V_max, "",$image
  27.         GetAxis/Q $vaxis
  28.         SetScale/I y, V_min, V_max, "",$image
  29.         $image= ContourZ("",plot,0,x,y)
  30.     else // Matrix contour
  31.         if( (strlen(xwave) + strlen(ywave)) > 0)    // these grid waves won't work with images
  32.             Abort "Can't append image because contour grid wave(s) don't work with image plots."
  33.         endif
  34.     endif
  35.     String cmd
  36.     sprintf cmd,"AppendImage%s %s",flags,PossiblyQuoteName(image)
  37.     Execute cmd
  38. End
  39.